package javaCode.chapter09.interface_;

public class Interface03 {
    public static void main(String[] args) {

        MysqlDB mysqlDB = new MysqlDB();
        OracleDB oracleDB = new OracleDB();
        t(mysqlDB);
        System.out.println("------");
        t(oracleDB);
    }

    public static void t(DBInterface db){
        db.connect();
        db.close();
    }
}

//A程序员 连接Mysql
class MysqlDB implements DBInterface{

    @Override
    public void connect() {
        System.out.println("连接mysql");
    }

    @Override
    public void close() {
        System.out.println("关闭mysql");
    }
}

//B程序员 连接Oracle
class OracleDB implements DBInterface{

    @Override
    public void connect() {
        System.out.println("连接oracle");
    }

    @Override
    public void close() {
        System.out.println("关闭oracle");
    }
}
